package com.ghpt.controller;
import com.ghpt.pojo.RanQiGuoLu;
import com.ghpt.service.RanQiGuoLuService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

@RestController
@RequestMapping("/guolu")
public class RanQiGuoLuController {
    private final RanQiGuoLuService ranQiGuoLuService;

    public RanQiGuoLuController(RanQiGuoLuService ranQiGuoLuService) {
        this.ranQiGuoLuService = ranQiGuoLuService;
    }
    @GetMapping("/{id}")
    public RanQiGuoLu getRanQiGuoLuById(@PathVariable Long id) {
        System.out.println("结果是"+ranQiGuoLuService.findRanQiGuoLuById(id));
        return ranQiGuoLuService.findRanQiGuoLuById(id);
    }
    @PutMapping
    public int updateRanQiGuoLu(@RequestBody RanQiGuoLu ranQiGuoLu) {
        return ranQiGuoLuService.updateById(ranQiGuoLu);
    }
}
